/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "animal", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "Animal.findAll", query = "SELECT a FROM Animal a"),
    @NamedQuery(name = "Animal.findByIdAnimal", query = "SELECT a FROM Animal a WHERE a.idAnimal = :idAnimal"),
    @NamedQuery(name = "Animal.findByAniNombre", query = "SELECT a FROM Animal a WHERE a.aniNombre = :aniNombre")})
public class Animal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_animal")
    private Integer idAnimal;
    @Column(name = "ani_nombre")
    private String aniNombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "aniIdAnimal")
    private List<TenenciaAnimal> tenenciaAnimalList;

    public Animal() {
    }

    public Animal(Integer idAnimal) {
        
        this.idAnimal = idAnimal;
    }

    public Integer getIdAnimal() {
        return idAnimal;
    }

    public void setIdAnimal(Integer idAnimal) {
        this.idAnimal = idAnimal;
    }

    public String getAniNombre() {
        return aniNombre;
    }

    public void setAniNombre(String aniNombre) {
        this.aniNombre = aniNombre;
    }

    public List<TenenciaAnimal> getTenenciaAnimalList() {
        return tenenciaAnimalList;
    }

    public void setTenenciaAnimalList(List<TenenciaAnimal> tenenciaAnimalList) {
        this.tenenciaAnimalList = tenenciaAnimalList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAnimal != null ? idAnimal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Animal)) {
            return false;
        }
        Animal other = (Animal) object;
        if ((this.idAnimal == null && other.idAnimal != null) || (this.idAnimal != null && !this.idAnimal.equals(other.idAnimal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.Animal[ idAnimal=" + idAnimal + " ]";
    }
    
}
